@echo off
setlocal

:: 获取输入的命令行参数
set "command=%0"
set "option=%1"
@REM echo Command: %0
@REM echo Option: %1
@REM echo Files: %*

:: 判断是否是patch命令
if "%command%"=="patch" (

    if "%option%"=="-update" (
        :: 删除 -update 选项，获取其余的参数
        shift
        if "%*"=="" (
            echo Error: Missing file parameter for -update.
        ) else (
            echo Applying patches: %*
            java -jar BesPatchTool-1.0.jar -update %*
        )
    ) else if "%option%"=="-rollback" (
        java -jar "BesPatchTool-1.0.jar" -rollback
    ) else if "%option%"=="-delete" (
        java -jar "BesPatchTool-1.0.jar" -delete
    ) else (
        echo Error: Invalid option after "patch". Use "-update" or "-revert".
    )
) else (
    echo Error: Invalid command. Use "patch".
)

endlocal
